package com.hello;

import java.util.Random;

public class 开发验证码 {
    public static void main(String[] args) {
        char[] chs=new char[52];
        for (int i = 0; i < chs.length; i++) {
            if(i<=25){//添加小写字母 a 97 A 65
                chs[i]=(char)('a'+i);
            }else{//添加大写字母
                chs[i]=(char)('A'+i-26);
            }

        }
        Random r=new Random();
        String result=" ";
        for (int i = 0; i < 4; i++) {
            int randomIndex=r.nextInt(chs.length);
            result+=chs[randomIndex];
        }
        int number=r.nextInt(10);
        result+=number;
        System.out.println(result);
    }
}
